Skip to main content

Full text of "Programming"

See other formats

Analyze Data from i Phone Rocket Flights 


Make Projects 

build, hack, tweak, share, discover. 

Analyze Data from iPhone 
Rocket Flights 

Written By: Mike West erf i eld 


Computer running Windows XP, Vista, or Mac OS X (1) 
i Phone. iPad or iPod touch (1) 
iTunes (1) 


This project walks you through the steps to download and install a program to analyze rocket 
data collected from flying a SensorTag on a model rocket. You'll find out the G forces on the 
rocket, how fast it went, how high it went, and see the rotation and air pressure during the 

Here's a link to the Maker project to built the ST-2 rocket that carried the i Phone in the 
movie. Build this rocket to collect your own data to analyze following the steps in this 

You don't need to know how to program to follow this project. You get the complete source 
code, though, so if you do know a little programming, you can tinker with the analysis 

© Make Projects Page 1 of 7 

Analyze Data from i Phone Rocket Flights 
program to learn even more. 

Step 1 — Analyze Data from iPhone Rocket Flights 

• Download the software and our 
sample files from here . 

• If your O/S doesn't do it 
automatically, unpack the zip 

• The software will work on both the 
i Phone and iPad. 

© Make Projects 

Page 2 of 7 

Analyze Data from i Phone Rocket Flights 

Step 2 

• Copy the contents of the file Analysis .bas and paste it into an otherwise empty email. 
Mail this to yourself. 

• If you are using techBASIC 2.3, use the file Analysis 2.3. bas instead of the file 

Analysis . bas. 

• From your iPhone or iPad, copy the contents of the email by tapping twice, then tapping 
Select All, then tapping Copy. 

• Create a new program. 

• iPhone/iPod: From techBASIC's Programs tab, tap New to create a new program. Use 
the name Analysis. 

• iPad: Tap the New button as the bottom of the Programs list to create a new program. 

• Paste the program into the newly created empty file by tapping the screen and then tapping 
the Paste button. 

© Make Projects 

Page 3 of 7 

Analyze Data from i Phone Rocket Flights 

Step 3 

• Copy my data files to techBASIC to 
get started. 

• Connect your iPhone or iPad to 
your computer. 

• Run iTunes. 

• Select your device from 

• Select Apps from the top menu. 

• Scroll down and select 

• Drag the data files to the 
techBASIC Documents list: 

flightl.txt, flightli.txt, 
flight2.txt, flight2i.txt, 
RocketDataCalibration . txt. 

Step 4 

• The picker lets you select from any 
available rocket data. It is showing 
four data files from our rocket 
flights. Tap a different flight to see 
its data. 

• The five buttons at the right let you 
show or hide the five available 

• Tap on a plot to see the numeric 
value at any specific point. 

© Make Projects 

Page 4 of 7 

Analyze Data from i Phone Rocket Flights 

Step 5 

Acceleration in G 

i i^ 


1 KL-E5. 711403, y=5.6131S2 I 

i i ill ill i 


Time in Seconds 

Velocity in m/s 

Time in Seconds 

Altitude in Meters 

Time in Seconds 

• Slide the plots around, use pinch 
gestures to expand or shrink the 
plots, or tap to see specific values. 

• Lift off was at about 55.5 
seconds into the data. 

• Maximum acceleration from the 
rocket engine was 5.6G, about 
0.2 seconds after lift off. 

• Maximum velocity was 22.7 
meters/second (51 miles per 
hour), and occurred about 2 
seconds after lift off. 

• Maximum altitude was 54.8 
meters (180 feet). This occurred 
after the rocket coasted for a 
couple of seconds. 

Step 6 

El T* \d 

Sou tee Console GrapMcs 

Q. r> c Ef 

Find l*l*> Redo Shire 


1 Racket Data Analysi 

3 This program analyzes data from rocket flights recorded with the Rocket Data 
I program. That program records acceleration, rotation and barometric pressure 
I during a rocket flight. 

1 Created at the Byte Works , Inc. 

! Copyright 2012, All Rights Reserved 

I support @ by teworks. us 

3 Permission is grandet to use and modify this program for any noncommercial use so 
1 long as the above copyright notice is not removed. 

* Create the liat at files we can display and process. 

!=ount - 4 

DIM files$[county , f lightTO (count) , £ lightTl(count) , caliblO ( count ) , ealibTi (count ) 

filesSflJ - "flightli.txt" 

files? (2 J ■ "flight2i.txt" 

files£(3) - "flighll.txt" 

filesS(4) - ,, tlight2.txt"| 

flightlndex -1 • 

calibFileS ■ "RocketDataCalibration *txt" 

! Define glebals. 

DIM accelPlot AS Plot, accelFlotPoint AS PlotFoint, accelFoints [ 2, 2) 

DIM velFlot AS Plot, velPlotFoint AS FlotPoint, velFointa(2, 2) 

DIM diatPlot AS Plot, distPlotPoint AS PlotPaint, distPoints( 2, 2) 

DIM gyroPlot AS Plat, gyroXPlatPoin t AS PlptPoint, gyroXPoints [ 2 , 2), gyrtjVPlotPoint 

AS PlotPaint, gyro¥Points(2, 2], gyroEPlctPoint AS PlotPcint, gyroZPoints [ 2 , 2) 

DIM isUisible(201 TO 2 05) AS INTEGER 

DIM baroFlot AS Plat, baroFlotFoint AS PlotFoint, baroPoints(2, 2) 

♦ Edit these lines near the start of 
the program to add your own data. 

• Change the value of count to the 
number of data files the program 
will list. 

• Add any new files by adding 
another line to set a value in the 
fiies$ array. Increment the 
number in parenthesis by one for 
each new file. Remember that 
file names are case-sensitive in 

© Make Projects 

Page 5 of 7 

Analyze Data from i Phone Rocket Flights 

Step 7 

Acceleration in G 

Itl4fr ■ 

t . .1 



» M 30 « BO «0 TO 80 30 100 110 

Time in Seconds 

Acceleration in G 



"I I 1 - 


57 EB 69 BO 

62 63 6J 6S 

Time in Seconds 

• The raw data will have a lot of extraneous information, as well as some valuable calibration 

• Find the start and end of the rocket flight. Enter the times in the Flight time fields. The 
plot will expand to show just the rocket flight. 

• Improve the accuracy by calibrating the device. 

• Sitting on the pad, the accelerometer should measure 1G. 

• Select about 10 seconds of data before the launch. Enter the times in the Calibration 
time fields to mathematically calibrate the sensor to 1G. 

© Make Projects 

Page 6 of 7 

Analyze Data from i Phone Rocket Flights 

Step 8 

Collect Data from an [Phone Rocket Flight 

WAdnuday, October 31, 2013 

It was a beautilul fall rooming as I carefully packed the parachute, s-lkl in the engine, and installed the 
igniter in my model rocket. I started the data collection program and slid th& payload with a... 
Read more.., 

Controlling the Tl SensorTag with t&chBASIC 

Wednesday. October 31,2012 

The Internet of Things has a new addition, and it's a great way to learn more about Bluetooth Ibw 
energy. Most Bluetooth lew energy devices are designed for a very specific use, but the new 



Accessing the Bluetooth low energy Accelerometer on the Tl SensorTag 

Wednesday, October 31, 2C12 

Bluetooth low energy offers a great way for iPhone and iPad epos to connect to external devices. 
Bluetooth low energy is free of the shackles imposed by Apple's WFi program so anyone can write 
Rcr.i mnm„. 

Tl SensorTag 

• There's a story behind the data, as 
well as some important caveats 
about errors. See the Rocket Data 
Analysis portion of this blog if you 
would like to learn more about how 
the calculations are done and how 
reliable they are. 

• See this blog if you would like to 
learn more about creating user 
interfaces in techBASIC. This is 
what you need to know to modify 
the controls you see in the 

• See this blog to learn more about 
using plots and graphics in 
techBASIC. This tells you how to 
change and create plots like the 
five used in this program. 

• See this blog to explore how data is 
actually collected from Bluetooth 
low energy devices like the Texas 
Instruments SensorTag. 

This document was last generated on 201 2-1 1-06 11 :32:23 AM. 

© Make Projects 

Page 7 of 7